<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link href="res/style.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
</head>
<body>
<div id="app" class="flex">
    <<main>
        <header class="flex">
            <div>
                <h3>源辰银行</h3>
                <small>ycinfo bank</small>
            </div>
            <div id="contact">
                <div>客服电话: 8888</div>
                <div>网址: www.ycinfo.bank.com</div>
            </div>
        </header>
        <div class="msg">
            倒计时: <h2>32</h2> 秒
        </div>
        <div id="pane" class="flex">
            <div class="btns">
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
            </div>
            <div id="info">
                <h2>请输入账号和密码</h2>
                <form action="main.html">
                    <input placeholder="账号" v-model="user.name"><br>
                    <input placeholder="密码" type="password" v-model="user.pwd">
                </form>
            </div>
            <div class="btns">
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
                <a class="right" @click="login">确定</a>
                <a class="right">退出</a>
            </div>
        </div>
    </main>>
</div>
</body>

<script>
    var v = new Vue({
        el:"#app",
        data:{
            user:{name:"", pwd:""},
            userinfo:{},
        },
        created(){

        },
        methods:{
            login(){
                let params = new URLSearchParams();
                params.append("name", this.user.name);
                params.append("pwd", this.user.pwd);
                axios.post("login", params).then(res=>{
                    console.log(res)
                    if( res.data.code == 1){
                        this.userinfo = res.data.data;
                        location.href = "main.html?id="+this.userinfo.id
                    }else{
                        this.$message(res.data.msg)
                    }
                });
            },
        }
    })
</script>
</html>
